package com.future.direction.ui.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.future.direction.R;
import com.future.direction.data.bean.ChosePayWayBean;

import java.util.List;

/**
 * @author xwl
 * @description:
 * @date :2020/2/19
 */
public class ChosePayWayAdapter extends BaseQuickAdapter<ChosePayWayBean, BaseViewHolder> {
    private int choseId = 0;

    public int getChoseId() {
        return choseId;
    }

    public void setChoseId(int choseId) {
        this.choseId = choseId;
        notifyDataSetChanged();
    }

    public ChosePayWayAdapter(int layoutResId, @Nullable List<ChosePayWayBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ChosePayWayBean item) {
        helper.setImageResource(R.id.iv_header,item.getHeader());
        helper.setText(R.id.tv_title,item.getTitle());
        if (helper.getLayoutPosition() == choseId) {
            helper.setImageResource(R.id.iv_chose_state,R.drawable.icon_chose_normal);
        }else {
            helper.setImageResource(R.id.iv_chose_state,R.drawable.icon_chose_default);
        }

    }

}
